/*
 * @Author: biankai
 * @Date: 2021-04-19 18:47:04
 * @LastEditTime: 2021-11-10 10:35:14
 * @LastEditors: biankai
 * @FilePath: /gitee/devops_service/src/controllers/jenkins/view.controller.ts
 */
import { Controller, Inject, Get, Query, Param, Post, Put, Delete, Body } from '@nestjs/common';
import { ApiCreatedResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
import { ViewService } from '../../services/jenkins/view.service';

@ApiTags('Jenkins-view')
@Controller('jenkins/view')
export class ViewController {
    constructor(@Inject(ViewService) private readonly viewService: ViewService) {
    }

    @ApiOperation({ summary: '获取', description: '说明 : 调用此接口,可获取' })
    @ApiCreatedResponse({
        description: 'The record has been successfully created.',
    })
    @Get('/viewList')
    async viewList() {
        return await this.viewService.viewList()
    }

    @ApiOperation({ summary: '获取', description: '说明 : 调用此接口,可获取' })
    @Get('/viewGet')
    async viewGet(@Param('viewName') viewName) {
        return await this.viewService.viewGet(viewName)
    }

    @ApiOperation({ summary: '获取', description: '说明 : 调用此接口,可新增' })
    @Post('/viewCreate')
    async viewCreate(@Query('viewName') viewName, @Query('viewType') viewType) {
        return await this.viewService.viewCreate(viewName, viewType)
    }

    @ApiOperation({ summary: '修改', description: '说明 : 调用此接口,可修改' })
    @Post('/viewAdd')
    async viewAdd(@Param('viewName') viewName, @Param('jobName') jobName) {
        return await this.viewService.viewAdd(viewName, jobName)
    }

    @ApiOperation({ summary: '删除', description: '说明 : 调用此接口,可删除' })
    @Delete('/viewRemove')
    async viewRemove(@Param('viewName') viewName, @Param('jobName') jobName) {
        return await this.viewService.viewRemove(viewName, jobName)
    }

    @ApiOperation({ summary: '删除', description: '说明 : 调用此接口,可删除' })
    @Put('/viewConfig')
    async viewConfig(@Param('viewName') viewName, @Param('configXml') configXml) {
        return await this.viewService.viewConfig(viewName, configXml)
    }

    @ApiOperation({ summary: '删除', description: '说明 : 调用此接口,可删除' })
    @Delete('/viewDestroy')
    async viewDestroy(@Query('viewName') viewName) {
        return await this.viewService.viewDestroy(viewName)
    }

    @ApiOperation({ summary: '删除', description: '说明 : 调用此接口,可删除' })
    @Get('/viewExists')
    async viewExists(@Param('viewName') viewName) {
        return await this.viewService.viewExists(viewName)
    }



}